-
Notifications
You must be signed in to change notification settings - Fork 262
Add support for "Forced Outcome" #1698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
|
Hold on review for a bit, re-examining. Definitely needs to combine probabilities of each reroll state, and refactoring it to fit more in line with other modifiers |
|
The math is kind of confusing at times, but I was so happy to see your Pull Request because I didn't want to write this myself. I pulled your code into my local machine and have been playing with it, but I think the Lucky stuff is wrong. Specifically, I was trying to get the node Lightning Rod to work for me with 30% Lucky on Lightning hits, and that led me to looking at how some of the math is done around Lucky. @Dimencia can you review this code below and see if it could be integrated or confirmed as correct for your Pull Request? The changes are primarily around the calculation for CritChanceLucky and I added a link in the comments to how that should be calculated. Thanks again for doing all the work! |
|
I should note regarding my code I just posted that I don't test for > 100% lucky and don't test bounds with m_max. Lua is still super new to me. |
|
Review can commence - I think the logic is fixed and in a better spot, renamed things to "ForcedOutcome" everywhere to avoid confusion with the inevitable critical support gem, and added some tests @jaredschnelle The node you're looking at is '30% chance for Lightning Damage with Hits to be Lucky' - the damage specifically is lucky, not the hit itself (such as its accuracy or crit chance), at least as far as I can tell and judging by existing code The lucky crit formula I'm using actually works out to be the same thing as your If you were seeing problems, it's probably because I wasn't really considering probabilities right, fixed in the latest PRs |
|
Yes, "damage lucky" is distinct from "critical hit chance is lucky". Afaik there's currently no "x% chance for critical hit chance to be lucky" in either game. It's binary on, or off. However, please note that both "lucky" and "unlucky", as well as "bifurcated" criticals count as "re-rolls" and would therefore cause the penalty from "Inevitable Critical" to be applied. |
|
Thank you both for the clarification. This game does have some crazy math inside of it. I didn't realize that the "Hit" happens before the "Damage" roll. Also, the fact that Rerolling from things like Lucky or Bifurcation diminish the crit damage applied really does change the way I was looking at things. It'd be interesting to get Bifurcation working with Inevitable Outcomes seeing as how the 2nd roll on Bifurcate will always have a lower Crit Damage Bonus. I realize this isn't strictly related to this PR, so I'll end it here. Thanks again for the insight. |
|
I pushed some changes recently that should address that, and am still working on more... kinda went a bit overboard refactoring things and need to put most of it back How it interacts with bifurcate/lucky is definitely weird and worth some discussion Personally I think that the wording of Bifurcation implies that it occurs once per hit, not once per roll: But on the other hand, I think the wording of lucky crits implies that it is in fact per roll: So my current approach is to use the full crit chance, which already scaled to consider the bifurcated reroll, for only the first hit's probability (and separately, just globally apply 30% less crit damage bonus if bifurcation is on, because it always rolls). As for lucky hits, I assume they're rolling twice every time forced outcome rerolls - meaning we shouldn't discard its effect on crit chance after the first hit (like with bifurcatino), but also that you end up with a 60% penalty per reroll (on top of a global 30% less for having lucky at all) I'm a little on the fence because that seems very harsh, but either way, I don't think you want to pair either one with forced outcome Here's a snippet of the relevant logic that I'm still considering |

Adds handling for Forced Outcome (Inevitable Critical Hits):
If there's a better place to put this logic, let me know. I'd like to add mods for this to make it more visible, but I don't think I can do so without affecting regular crits, which should be unchanged. I think it is appropriate that the crit chance is still shown at the base crit chance instead of 100%, though
This does not handle edge cases like crit bifurcation, which I'm not familiar enough with to try to consider, but it might be good to get this added and then add support for bifurcated crits in a later PR